package com.azure.mapper.bigstore;

import com.azure.entity.TOrderitem;
import com.azure.entity.TOrderitemExample;

import java.time.LocalDate;
import java.util.List;

import net.minidev.json.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface TOrderitemMapper {
    int countByExample(TOrderitemExample example);

    int deleteByExample(TOrderitemExample example);

    int deleteByPrimaryKey(Long id);

    int insert(TOrderitem record);

    int insertSelective(TOrderitem record);

    List<TOrderitem> selectByExample(TOrderitemExample example);

    TOrderitem selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") TOrderitem record, @Param("example") TOrderitemExample example);

    int updateByExample(@Param("record") TOrderitem record, @Param("example") TOrderitemExample example);

    int updateByPrimaryKeySelective(TOrderitem record);

    int updateByPrimaryKey(TOrderitem record);

    @Select("select pid,sum(num) hot from t_orderitem where date >= #{date} group by pid order by hot desc")
    List<JSONObject> totalDailyReport(@Param("date") LocalDate date);
    @Select("select pid,sum(num) hot from t_orderitem where date between #{startDate} and #{stopDate} group by pid order by hot desc")
    List<JSONObject> totalMonthlyReport(@Param("startDate") LocalDate startDate,@Param("stopDate") LocalDate stopDate);
}